package com.swjd.dao;

import com.swjd.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
@Transactional
public interface UserDao extends CrudRepository<User,Integer> {
    @Modifying
    @Query(value = "update User set username = :username where id = :id ",nativeQuery = true)
    public int updateNameById(@Param("id") Integer id,@Param("username")String username);
}
